package com.aaa.sbm;

import com.aaa.sbm.controller.UserController;
import com.aaa.sbm.entity.EntityA;
import com.aaa.sbm.entity.EntityB;
import com.aaa.sbm.service.UserService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * @FileName: SpringbootMybatisApplication
 * @Description:
 * @Author: zhz
 * @CreateTime: 2025/8/26 10:41
 * @Version: 1.0.0
 */
@SpringBootApplication//(exclude = {DataSource.class})
//    @SpringBootConfiguration
//    @EnableAutoConfiguration
//    @ComponentScan("com")
@MapperScan("com.aaa.sbm.dao") //扫描所有dao接口
public class SpringbootMybatisApplication {
    //@SpringBootApplication
    public static void main(String[] args) {
        //String[] a={"com.aaa.sbm.entity.EntityC","com.aaa.sbm.entity.EntityD","com.aaa.sbm.entity.EntityE"}
       //String[] b= {"org.mybatis.spring.boot.autoconfigure.MybatisLanguageDriverAutoConfiguration",
        //"org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration"}
        //使用SpringApplication启动springboot
        ConfigurableApplicationContext applicationContext = SpringApplication.run(SpringbootMybatisApplication.class, args);
        EntityA entityA = (EntityA)applicationContext.getBean("ea1");
        UserController userController = (UserController)applicationContext.getBean("uc1");
        UserService userService = userController.getUserService();
        userController.queryById(101);
        System.out.println(userService);

        EntityB entityB = entityA.getEntityB();
        entityA.printA();
        entityB.printB();
    }
}
